This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
~Ted Desveluchekings 28.Oct.03 08:04 PM a Web browser Domino Designer6.0.1Windows NT
Hello,
I have a database where completed documents are eventually sent to an archive database. When this happens, the documents' responses become orphans. So I wrote a "Delete Orphans" agent that looks like this:
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db=session.currentdatabase
Dim doc As NotesDocument
Dim parentdoc As NotesDocument
Dim dc As NotesDocumentCollection
Set dc = db.AllDocuments
For j = 1 To dc.Count
Set doc = dc.GetNthDocument(j)
If doc.IsResponse = True Then
Set parentdoc = db.GetDocumentByUNID(doc.ParentDocumentUNID)
On Error Resume Next
If (parentdoc.Responses Is Nothing) Then
Call doc.Remove(True)
End If
End If
Next j
End Sub
Since the parent document was deleted, I was hoping to satisfy the "Is Nothing" condition. Instead, the previous document's parent is still there. Or, if the first document is an orphan, I get an "Invalid universal ID" message.
This agent used to work and now it doesn't. The only thing I could possibly have changed is the "Soft Deletion" option.